Adding Parameter Input to the Report
Banded Reports obtain query results from the DataBlock to report on the contents of a database. Other information not contained within the report query can be obtained and inserted into your report, including items such as:
- Date and time the report was generated
- Information about the database connection such as the data source name, driver name and version, SQL format, etc.
- DataBlock name and path
- Report name and path
- Username and user type
- The search parameters chosen from the DataBlock form.
Tip: Adding the selections made within the DataBlock form to the report provides very useful background information used to create the report.
To obtain this information you need to add an expression field into the desired band using methods you are now familiar with. This is done by clicking the E=mc2 icon on the Band Report Editor Toolbar, then clicking within the band where you want the field to be placed.
Click on the ellipses icon to the right of the expression box to launch the Expression Editor.
The Expression dialog boxes above are displayed. From the Expression Wizard, click the “Variable” button which displays the list of variables that can be inserted into the band. Variables preceded with a $ are system variables. Variables without the $ are items selected from the DataBlock form used to create the report.
For this example, the DataBlock name as well as the departments selected within the DataBlock form will be placed into Summary Band that was created in this example.
The DataBlock form for Example 1 consists of a list of department names which is contained in the variable LISTBOX1.DEPT_NAME shown at the bottom of the list in the above figure.
To add the selected department names into the Summary Band, click the LISTBOX1.DEPT_NAME variable and it will be placed within the band. When adding the expression to the band, select the “Autostretch height” box which will increase the height of the band, if necessary, to accommodate the list of selections from the form.
To add the DataBlock name to the Summary Band, repeat the above process to add an expression field and select the variable GETVARIABLE(‘$DATABLOCK.NAME’).
The DataBlock Name (User Guide) as well as the Departments selected within the DataBlock form (Product Dev, HR, Sales) now appear within the Summary Band. Labels (“DataBlock Name” and “Departments Selected”) were added separately to describe the newly added information.